package com.jjh.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

@Aspect
public class TestTimeAspect {

    @Around("@annotation(com.jjh.annation.TestTime)")
    public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
        long startTime = System.currentTimeMillis();
        Object result = joinPoint.proceed();
        long endTime = System.currentTimeMillis();
        System.out.println("方法: " + joinPoint.getSignature().getName() + " 执行耗时: " + (endTime - startTime) + "ms");
        return result;
    }



}
